home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / mail / mh / contrib / 9302 / prunemail.shar / prunemail next >
Text File  |  1993-02-03  |  928b  |  27 lines

  1. #! /bin/csh -f
  2. # eliminate all messages in $1 with duplicate message-ids
  3. #
  4. # Subject: MH utility to delete duplicate messages in a folder
  5. # Date: Wed, 19 Aug 92 11:48:45 -0400
  6. # From: Bob Munck <munck@Stars.Reston.Unisys.COM>
  7. # Fixed to delete only messages with message-ids.
  8. # Roger Corron  <rc@boston.sgi.com>
  9. #
  10. # I debated using "$1" everywhere I have "+$1", since the user
  11. # would then need the "+" and would be following MH conventions
  12. # more closely.  I suppose a real convention-following utility
  13. # would also allow defaulting by using Path from ~/.mh-profile
  14. # to find context and getting Current-Folder from it.  
  15.  
  16. if ( ( $#argv == 0 ) || ( $1 == -help ) || ( $1 == -h ) ) then
  17.    echo 'USAGE: prune-mail folder'
  18.    exit 0
  19.    endif
  20. folder +$1
  21. set s =  `scan +$1 -format "%4(putnumf(msg))    %{message-id}"|grep '.*<.*>.*' | sort +1|uniq -d +5|sed 's/    .*$//'`
  22. if ( "$s" != "" ) then
  23.    rmm $s +$1
  24.    folder +$1
  25.    endif
  26.